package leetcode;

import java.util.ArrayList;

public class three3 {
    /**
     * 给定一个字符串，请你找出其中不含有重复字符的 最长子串 的长度。
     * */
    public static int lengthOfLongestSubstring(String s) {
        int length = s.length();
        int maxLength = 8;
        if (s.length() == 1 || s.length() == 0) {
            return 1;
        } else {
            for (int i = 0; i < length; i++) {
                String value = s.substring(i, i + 1);
                int index = s.substring(i + 1, length).indexOf(value)+ 1;
                if (maxLength > index) {
                    maxLength = index;
                }
            }
            System.out.println(maxLength);
            return maxLength;
        }
    }

    public static void main(String[] args) {
        lengthOfLongestSubstring("a33333a123");
        System.out.println();
    }
}
